<template>
 <div>
 <el-card class="box-card">
  <div slot="header" class="clearfix">
    <span>新人注册后第一次打开App推荐进入房间</span>
  </div>
  <el-form :model="form" :rules="rules" ref="form" label-width="80px">
    <el-form-item label="房间id" prop="value">
      <el-col :span="16">
       <el-input v-model="form.value" ></el-input>
       </el-col>
    </el-form-item>
    <el-form-item>
       <el-button type="primary" @click="deBounceWrap(handleSumbit)">提交</el-button>
    </el-form-item>
  </el-form>
</el-card>
 </div>
</template>
<script>
import {randomRoom,randomHotRoom} from "@/api/room/randomRoom"
 export default {
   data(){
     return{
       form:{
         value:undefined
       },
       count:undefined,
       rules:{
         value:[
            { required: true, message: '请输入房间号', trigger: 'blur' },
         ]
       },

     }
   },
   created(){
     this.getRandomRoom()
   },
   methods:{
     getRandomRoom(){
       randomRoom().then(res=>{
         this.form.value = res.data
         this.count = res.data
       })
     },
    handleSumbit(){
        if(this.count === this.form.value){
            this.$message.warning('当前房间id没有改变')
            return
        }
      randomHotRoom({room_ids:this.form.value}).then(res=>{
            this.$message.success("成功")
      })
    }
   }
 }
</script>
<style>

</style>
